package com.huluobo.hyj.hyjmodel.adapter

import android.content.Context
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.huluobo.hyj.hyjmodel.data.AddFriendItem
import com.huluobo.hyj.hyjmodel.widet.AddFriendListitemView

/**
 *@author : USER
 *@date : 2020/9/17 15:24
 *@params :
 *@description:
 */
class AddfiendAdapter(val context:Context,
                      val addFriendItems: MutableList<AddFriendItem>
):RecyclerView.Adapter<RecyclerView.ViewHolder>() {

    //适配器返回布局
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return AddFriendListItemViewHolder(AddFriendListitemView(context))
    }
    //固定数据
    override fun getItemCount(): Int =  addFriendItems.size

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        val AddFriendListView = holder.itemView as AddFriendListitemView
        AddFriendListView.bindView(addFriendItems[position])
    }
    //自定义ViewHolder
    class AddFriendListItemViewHolder(itemView: View) :RecyclerView.ViewHolder(itemView){

    }
}